/************************************************************************

								Heroes IV
					  Copyright 2001, The 3DO Company

	------------------------------------------------------------------
  							linkage_data.h

	$Header: $

	$NoKeywords: $

 ************************************************************************/

#if !defined( LINKAGE_DATA_H_INCLUDED )
#define LINKAGE_DATA_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <iosfwd>
#include <string>

class t_adventure_map;
enum t_random_object_link_type;
enum t_town_type;
enum t_player_color;

// ------------------------------------------------------------------------------
// t_linkage_data class
// Contains all the data needed to link a random whatever to a town or player
// Use read_from_map() to read the data from the map file, then, after the map
// is fully read in, use get_link_alignment() to get the alignment of the link
// target
// ------------------------------------------------------------------------------
class t_linkage_data
{
	public:
		// Possible returns from get_link_alignment()
		enum t_link_alignment
		{
			// The normal town/player alignments:
			k_link_alignment_life = 0,
			k_link_alignment_order,
			k_link_alignment_death,
			k_link_alignment_chaos,
			k_link_alignment_nature,
			k_link_alignment_might,

			// Any alignment is OK (usually because object was not linked to anything)
			k_link_alignment_any,

			// Link target is not yet initialized; wait for next round of preplacement() calls
			k_link_alignment_wait,

			k_link_alignment_count
		};

		explicit t_linkage_data( bool allow_towns = true );

		t_link_alignment get_link_alignment( t_adventure_map & map, int pass ) const;
		bool			 read_from_map( std::streambuf & stream );
		void			 reset(); 

		static t_link_alignment town_type_to_link_alignment( t_town_type town_type );
		static t_town_type      link_alignment_to_town_type( t_link_alignment link_type );

	private:
		bool						m_allow_towns;
		t_random_object_link_type	m_type;
		std::string					m_town_name;
		t_player_color				m_player_color;
};

#endif // LINKAGE_DATA_H_INCLUDED
